package com.andyage.admin.action;

import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.andyage.admin.bean.RoleBean;
import com.andyage.admin.service.IRoleService;

@Controller
@RequestMapping("/admin")
public class RoleAction {
	@Resource
	private IRoleService iroleService;
	public  String CONTENT_TYPE="text/html;charset=utf-8";

	@RequestMapping("/queryRoleInfo")
	public void queryRoleInfo(RoleBean roleBean, HttpServletResponse response) throws Exception {
		String json = iroleService.queryRoleInfo(roleBean);
		response.setContentType(CONTENT_TYPE);
		response.getWriter().print(json);
	}

	@RequestMapping("/addRoleInfo")
	public void addRoleInfo(RoleBean roleBean, HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		String json = iroleService.addRoleInfo(roleBean);
		response.setContentType(CONTENT_TYPE);
		response.getWriter().print(json);
	}

	@RequestMapping("/updateRoleInfo")
	public void updateRoleInfo(RoleBean roleBean, HttpServletResponse response) throws Exception {
		String json = iroleService.updateRoleInfo(roleBean);
		response.setContentType(CONTENT_TYPE);
		response.getWriter().print(json);
	}
}
